package com.xywl.escort.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xywl.escort.R;
import com.xywl.escort.bean.RankingListResp;

import java.util.List;

public class LeaderBoardAdapter extends BaseQuickAdapter<RankingListResp.DataBean.ListBean, BaseViewHolder> {
    public LeaderBoardAdapter(int layoutResId, @Nullable List<RankingListResp.DataBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, RankingListResp.DataBean.ListBean item) {
        ImageView imageRanking = helper.getView(R.id.image_ranking);
        int position = helper.getLayoutPosition();
        helper.setText(R.id.text_name, item.nicknameShow);
        helper.setText(R.id.text_count, item.total + "份");
        helper.setText(R.id.text_time, item.lastTime);

        switch (position) {
            case 0: {
                imageRanking.setVisibility(View.VISIBLE);
                imageRanking.setImageResource(R.mipmap.kits_subscribe_list1);
            }
            break;
            case 1: {
                imageRanking.setVisibility(View.VISIBLE);
                imageRanking.setImageResource(R.mipmap.kits_subscribe_list2);
            }
            break;
            case 2: {
                imageRanking.setVisibility(View.VISIBLE);
                imageRanking.setImageResource(R.mipmap.kits_subscribe_list3);
            }
            break;
            default: {
                imageRanking.setVisibility(View.INVISIBLE);
                imageRanking.setImageResource(R.mipmap.kits_subscribe_list1);
            }
            break;
        }
    }
}
